package com.rt.easyjava.common.utils.others;

import java.io.UnsupportedEncodingException;
import java.util.ResourceBundle;

public class Config {
	public static String webTitle;
	public static String projectWeb;
	public static String projectBiz;
	public static String projectFtl;
	public static String keyPairLocation;
	public static int CodeBuildMode_IsDubble;


	public static final String url_queryPage;
	public static final String url_queryAction;
	public static final String url_addAction;
	public static final String url_removeAction;
	public static final String url_addeditPage;
	public static final String url_historyPage;
	public static final String url_reportPage;
	public static final String url_formReportAction;

	public static final String url_queryPage_sc;
	public static final String url_queryAction_sc;
	public static final String url_addeditPage_sc;
	public static final String url_addAction_sc;
	public static final String url_editAction_sc;
	public static final String url_removeAction_sc;
	public static final String url_formReportAction_sc;

	public static final String db_dialect;
	public static final String db_name;

	public static final String url_chartMS;
	public static final String url_chartMSAction;
	public static final String url_chartSingle;
	public static final String url_chartSingleAction;
	public static final String url_chartPie;
	public static final String url_chartPieAction;

	public static final int listeningPort;
	public static final String targetIp;
	public static final int targetport;

	public static final int CORE_POOL_SIZE;
	public static final int MAX_POOL_SIZE;
	public static final String MerchantIdHuaXia;
	public static final String SubMerchantIdHuaXia;

	public static final String host;
	public static final String email;
	public static final String user;
	public static final String password;
	public static final String toEmail;

	public static final String merchantDailyReportPath ;
	public static final String merchantCheckReportPath ;

	//商户密钥存放位置
	public static final String MerchantKeyPosition;

	public static final String ElFinderPath;

	static{
		ResourceBundle rb = ResourceBundle.getBundle("config");

		try {
			webTitle = new String(rb.getString("webTitle").getBytes("ISO-8859-1"), "UTF-8");
			keyPairLocation = new String(rb.getString("keyPairLocation").getBytes("ISO-8859-1"), "UTF-8");
			CodeBuildMode_IsDubble =  Integer.parseInt(rb.getObject("CodeBuildMode_IsDubble").toString());


			String projectWeb_nodubble = new String(rb.getString("projectWeb_nodubble").getBytes("ISO-8859-1"), "UTF-8");
			String projectBiz_nodubble = new String(rb.getString("projectBiz_nodubble").getBytes("ISO-8859-1"), "UTF-8");
			String projectFtl_nodubble = new String(rb.getString("projectFtl_nodubble").getBytes("ISO-8859-1"), "UTF-8");

			String projectWeb_dubble = new String(rb.getString("projectWeb_dubble").getBytes("ISO-8859-1"), "UTF-8");
			String projectBiz_dubble = new String(rb.getString("projectBiz_dubble").getBytes("ISO-8859-1"), "UTF-8");
			String projectFtl_dubble = new String(rb.getString("projectFtl_dubble").getBytes("ISO-8859-1"), "UTF-8");

			if(CodeBuildMode_IsDubble == 1) {
				projectWeb = projectWeb_dubble;
				projectBiz = projectBiz_dubble;
				projectFtl = projectFtl_dubble;
			}else{
				projectWeb = projectWeb_nodubble;
				projectBiz = projectBiz_nodubble;
				projectFtl = projectFtl_nodubble;
			}

		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}

		ElFinderPath = rb.getString("ElFinderPath") ;

		rb = ResourceBundle.getBundle("configbiz");
		url_queryPage = rb.getString("url_queryPage");
		url_queryAction = rb.getString("url_queryAction");
		url_addAction = rb.getString("url_addAction");
		url_removeAction = rb.getString("url_removeAction");
		url_addeditPage = rb.getString("url_addeditPage");
		url_historyPage = rb.getString("url_historyPage");
		url_reportPage = rb.getString("url_reportPage");
		url_formReportAction = rb.getString("url_formReportAction");

		url_queryPage_sc = rb.getString("url_queryPage_sc");
		url_queryAction_sc = rb.getString("url_queryAction_sc");
		url_addAction_sc = rb.getString("url_addAction_sc");
		url_editAction_sc = rb.getString("url_editAction_sc");
		url_addeditPage_sc = rb.getString("url_addeditPage_sc");
		url_removeAction_sc = rb.getString("url_removeAction_sc");
		url_formReportAction_sc = rb.getString("url_formReportAction_sc");

		url_chartMS = rb.getString("url_chartMS");
		url_chartSingle = rb.getString("url_chartSingle");
		url_chartMSAction = rb.getString("url_chartMSAction");
		url_chartSingleAction = rb.getString("url_chartSingleAction");
		url_chartPie = rb.getString("url_chartPie");
		url_chartPieAction = rb.getString("url_chartPieAction");

		listeningPort = Integer.valueOf(rb.getString("listeningPort"));
		targetIp = rb.getString("targetIp");
		targetport = Integer.valueOf(rb.getString("targetport"));
		CORE_POOL_SIZE = Integer.valueOf(rb.getString("CORE_POOL_SIZE"));
		MAX_POOL_SIZE = Integer.valueOf(rb.getString("MAX_POOL_SIZE"));
		MerchantIdHuaXia = rb.getString("MerchantIdHuaXia");
		SubMerchantIdHuaXia = rb.getString("SubMerchantIdHuaXia");

		host = rb.getString("host");
		email = rb.getString("email");
		user = rb.getString("user");
		password = rb.getString("password");
		toEmail = rb.getString("toEmail");


		merchantDailyReportPath = rb.getString("merchantDailyReportPath") ;
		merchantCheckReportPath = rb.getString("merchantCheckReportPath") ;

		MerchantKeyPosition = rb.getString("MerchantKeyPosition") ;

		db_name = rb.getString("db_name") ;
		//访止工具类生成api copy 到 web项目中没有property出错
		String db_dialectTmp = "";
		try{
			db_dialectTmp = rb.getString("db_dialect");
		}catch (Exception e){
			e.printStackTrace();
		}
		db_dialect = db_dialectTmp;
	}




}
